Fix the build.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 10 Jan 2006 14:53:39 +0000 (15:53 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 10 Jan 2006 14:53:39 +0000 (15:53 +0100)
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/libxc/xc_linux_build.c

index ed1cafc71b0cf45f3d2e2fa8b6c41d476d1e0fd1..5312b42bbaf4f31be1cd0584fd721986a17dab37 100644 (file)
@@ -402,8 +402,11 @@ static int setup_guest(int xc_handle,
         ctxt->initrd.start    = 0;
         ctxt->initrd.size     = 0;
     }
-    strncpy((char *)ctxt->cmdline, cmdline, IA64_COMMAND_LINE_SIZE);
-    ctxt->cmdline[IA64_COMMAND_LINE_SIZE-1] = '\0';
+    if ( cmdline != NULL )
+    {
+        strncpy((char *)ctxt->cmdline, cmdline, IA64_COMMAND_LINE_SIZE);
+        ctxt->cmdline[IA64_COMMAND_LINE_SIZE-1] = '\0';
+    }
     munmap(start_info, PAGE_SIZE);
 
     free(page_array);
@@ -693,12 +696,11 @@ static int setup_guest(int xc_handle,
         start_info->mod_start    = vinitrd_start;
         start_info->mod_len      = initrd_len;
     }
-    if (cmdline != NULL) {
+    if ( cmdline != NULL )
     {
         strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
         start_info->cmd_line[MAX_GUEST_CMDLINE-1] = '\0';
-    } else
-        start_info->cmd_line[0] = '\0';
+    }
     munmap(start_info, PAGE_SIZE);
 
     /* shared_info page starts its life empty. */
@@ -759,8 +761,7 @@ int xc_linux_build(int xc_handle,
         goto error_out;
     }
 
-    if ( (image_name == NULL) ||
-         ((image = xc_read_kernel_image(image_name, &image_size)) == NULL) )
+    if ( (image = xc_read_kernel_image(image_name, &image_size)) == NULL )
         goto error_out;
 
     if ( (ramdisk_name != NULL) && (strlen(ramdisk_name) != 0) )